﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;

namespace MyVoiceControl.Speech
{
    public class Speaker
    {
        public Speaker()
        { }
        public void Init()
        {
            // Initialize a new instance of the SpeechSynthesizer.
            using (SpeechSynthesizer synth = new SpeechSynthesizer())
            {

                // Configure the audio output. 
                synth.SetOutputToDefaultAudioDevice();
                

                // Create a prompt from a string.
                PromptBuilder pb = new PromptBuilder();
                pb.AppendText("Landing gear deployed.");
                pb.StartVoice(VoiceGender.Female, VoiceAge.Child);
                pb.EndVoice();

                
                Prompt txt = new Prompt("Landing gear deployed.");
                
                // Speak the contents of the prompt synchronously.
                synth.SpeakAsync(pb);

                Console.WriteLine();
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }

        }
    }
}
